//
//  BCHTTPRequest.m
//  YunShangHui
//
//  Created by HMN on 14-6-9.
//  Copyright (c) 2014年 John. All rights reserved.
//

#import "WLHTTPRequest.h"
#import "AFNetworking.h"
#import "DMCAlertCenter.h"
#import "SVProgressHUD.h"
//#import "userInfoTool.h"

@implementation WLHTTPRequest


#pragma mark BaseRequest
///获取Dictionary数据
+ (void)GETDictionaryWithStringURL:(NSString *)stringURL usingSuccessBlock:(void (^)(NSDictionary *resultDictionary))successBlock andFailureBlock:(void (^)(NSError *resultError))failureBlock
{

    [SVProgressHUD show];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:stringURL]];
    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
    __weak AFHTTPRequestOperation *weakOperation = operation;
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"%@",[[NSString alloc] initWithData:weakOperation.responseData encoding:NSUTF8StringEncoding]);
        successBlock([NSJSONSerialization JSONObjectWithData:weakOperation.responseData options:NSJSONReadingMutableContainers error:nil]);
        [SVProgressHUD dismiss];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        failureBlock(error);
        [SVProgressHUD dismiss];
    }];
    [operation start];
}


//POST请求获取字典数据
+ (void)POSTDictionaryWithStringURL:(NSString *)stringURL
                              Parma:(NSDictionary *)parma
                       SuccessBlock:(void(^)(NSDictionary * resultDictionary))SuccessBlock
                       FailureBlock:(void(^)(NSError * error))FailureBlock{
    [SVProgressHUD show];

    AFHTTPRequestOperationManager * manger = [AFHTTPRequestOperationManager manager];
    [manger POST:stringURL parameters:parma success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if ([responseObject[@"status"] intValue]==205) {
        
            [[DMCAlertCenter defaultCenter] postAlertWithMessage:[responseObject[@"msg"] stringByAppendingString:@",请重新登录"]];
//            [userInfoTool removeUserInfo];
            [SVProgressHUD dismiss];

            
        }

     SuccessBlock(responseObject);
        
        [SVProgressHUD dismiss];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [[DMCAlertCenter defaultCenter] postAlertWithMessage:error.localizedDescription];
        FailureBlock(error);
        [SVProgressHUD dismiss];
    }];
}
//POST请求获取字典数据
+ (void)POSTDictionaryNoShowWithStringURL:(NSString *)stringURL
                              Parma:(NSDictionary *)parma
                       SuccessBlock:(void(^)(NSDictionary * resultDictionary))SuccessBlock
                       FailureBlock:(void(^)(NSError * error))FailureBlock{
//    [SVProgressHUD show];
    
    AFHTTPRequestOperationManager * manger = [AFHTTPRequestOperationManager manager];
    [manger POST:stringURL parameters:parma success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if ([responseObject[@"status"] intValue]==205) {
            
            [[DMCAlertCenter defaultCenter] postAlertWithMessage:responseObject[@"msg"]];
//            [userInfoTool removeUserInfo];
            [SVProgressHUD dismiss];
            
            
        }
        
        SuccessBlock(responseObject);
        
        [SVProgressHUD dismiss];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [[DMCAlertCenter defaultCenter] postAlertWithMessage:error.localizedDescription];
        FailureBlock(error);
        [SVProgressHUD dismiss];
    }];
}

/**是否登陆*/
+ (BOOL)isLogIn{
   
    if ([[NSUserDefaults standardUserDefaults] objectForKey:userInf]) {
        return YES;
    }
    return NO;
}

/**登陆*/
+ (void)logInWithParam:(NSDictionary *)param
     usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
       andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/user/user_login",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {

        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
   

}
/**获取验证码*/
/**手机发送验证码*/
+ (void)getAuthorCodeWithParam:(NSDictionary *)param usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
               andFailureBlock:(void (^)(NSError *resultError))failureBlock{

    NSString * urlString = [NSString stringWithFormat:@"%@/user/send_rangCode",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}

/**验证验证码*/
/**验证验证码*/
+ (void)checkCodeWithParam:(NSDictionary *)param usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
               andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    
    NSString * urlString = [NSString stringWithFormat:@"%@/user/check_code",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}
/**注册*/
#pragma mark 注册
+(void)registerSetInfoWithParam:(NSDictionary *)param usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
                        andFailureBlock:(void (^)(NSError *resultError))failureBlock{
   
       NSString * urlString = [NSString stringWithFormat:@"%@/user/user_register",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
       
   }

#pragma mark - 主页
/**热销商品*/
#pragma mark 热销商品
+ (void)getCommodityListWithParam:(NSDictionary *)param
         usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
          andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    
    NSString * urlString = [NSString stringWithFormat:@"%@/commodity/search_commdity",kMainUrl];
    
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}
/**商品详情*/
#pragma mark 商品详情
+ (void)getGoodsDeatailWithParam:(NSDictionary *)param
usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    
    NSString * urlString = [NSString stringWithFormat:@"%@/commodity/getDetail",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}

/**商品价格*/
#pragma mark 商品价格
+ (void)getGoodsPricelWithParam:(NSDictionary *)param
               usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
                andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/commodity/getPriceBysizeAndColor",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}

/**商品颜色或者尺寸*/
#pragma mark 商品颜色或者尺寸
+ (void)getSizeOrColorParam:(NSDictionary *)param
           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/commodity/getPriceBysizeAndColor",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}

/**授权码查询*/
#pragma mark 授权码查询
+ (void)checkPramaWithParam:(NSDictionary *)param
           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/authorize/check_authorize",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];

}

/**活动列表*/
#pragma mark 活动列表
+ (void)getActivityListWithParam:(NSDictionary *)param
                usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
                 andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/activity/getActivity",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];

}
/**活动详情*/
#pragma mark 活动详情
+ (void)getActivityDetailWithParam:(NSDictionary *)param
                  usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
                   andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/activity/getActivityDetail",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
    
}
/**报名活动*/
#pragma mark 报名活动
+ (void)joinInActivityWithParam:(NSDictionary *)param
               usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
                andFailureBlock:(void (^)(NSError *resultError))failureBlock{
    NSString * urlString = [NSString stringWithFormat:@"%@/activity/join_activity",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}
/**评论活动*/
#pragma mark 评论活动
+ (void)commentActivityWithParam:(NSDictionary *)param
                usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
                 andFailureBlock:(void (^)(NSError *resultError))failureBlock{

    NSString * urlString = [NSString stringWithFormat:@"%@/activity/discuss_activity",kMainUrl];
    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
        sucessBlock(YES,resultDictionary);
    } FailureBlock:^(NSError *error) {
        
    }];
}
//    [self getDictionaryWithStringURL:urlString usingSuccessBlock:^(NSDictionary *resultDictionary) {
//        
//    } andFailureBlock:^(NSError *resultError) {
//        
//    }];



///**精品列表*/
//#pragma mark 精品列表
//+ (void)getGoodsStoreListWithParam:(NSDictionary *)param
//                  usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                   andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/product/products",kMainUrl];
//  
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//    
//}
///**找回密码*/
//#pragma mark 找回密码
//+ (void)ForgetPwdWithParam:(NSDictionary *)param
//                     usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                      andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/user/resetPassword",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//    
//}
///**意见反馈*/
//#pragma mark 意见反馈
//+ (void)feedbackWithParam:(NSDictionary *)param
//               usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/feedback/create",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
//
///**修改密码*/
//#pragma mark 修改密码
//+ (void)changePWdWithParam:(NSDictionary *)param
//          usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//           andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//
//    NSString * urlString = [NSString stringWithFormat:@"%@/user/changePassword",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**获取地址列表*/
//#pragma mark 获取地址列表
//+ (void)getAddrListWithParam:(NSDictionary *)param
//          usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//           andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/addr/list",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**删除地址*/
//#pragma mark 删除地址
//+ (void)deleteAddrWithParam:(NSDictionary *)param
//            usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//             andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/addr/delete",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**获取订单列表*/
//#pragma mark 获取订单列表
//+ (void)getOrderListWithParam:(NSDictionary *)param
//           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//
//    NSString * urlString = [NSString stringWithFormat:@"%@/order/list",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**获取收藏的店铺列表*/
//#pragma mark 获取收藏的店铺列表
//+ (void)getMyCollectedShopWithParam:(NSDictionary *)param
//             usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//              andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/favorite/list",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**获取用户信息*/
//#pragma mark 获取用户信息
//+ (void)getPersonInfoWithParam:(NSDictionary *)param
//                   usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                    andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/user/info",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**用户信息修改*/
//#pragma mark 用户信息修改
//+ (void)modifyPersonInfoWithParam:(NSDictionary *)param
//              usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//               andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/user/edit",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**获取任务列表*/
//#pragma mark 获取任务列表
//+ (void)getTaskListWithParam:(NSDictionary *)param
//                 usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                  andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//
//    NSString * urlString = [NSString stringWithFormat:@"%@/dispatch/admin",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**获取订单详情*/
//#pragma mark 获取订单详情
//+ (void)getDetailOrderWithParam:(NSDictionary *)param
//            usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//             andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/order/info",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**订单操作*/
//#pragma mark 订单操作
//+ (void)changeOrderWithParam:(NSDictionary *)param
//               usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/order/operateCreate",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
////andFailureBlock:(void (^)(NSError *resultError))failureBlock;
///**新增地址*/
//#pragma mark 新增地址
//+ (void)AddNewAddrWithParam:(NSDictionary *)param
//           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//
//    NSString * urlString = [NSString stringWithFormat:@"%@/addr/add",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**编辑地址*/
//#pragma mark 编辑地址
//+ (void)EditAddrWithParam:(NSDictionary *)param
//           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/addr/change",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
//
///**订单评价*/
//#pragma mark 订单评价
//+ (void)AppraiseOrderWithParam:(NSDictionary *)param
//           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/comment/create",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
//
///**查看订单评论*/
//#pragma mark 查看订单评论
//+ (void)AppraiseOrdeInforWithParam:(NSDictionary *)param
//                  usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                   andFailureBlock:(void (^)(NSError *resultError))failureBlock {
//    NSString * urlString = [NSString stringWithFormat:@"%@/comment/orderCommentInfo",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
///**学校列表*/
//#pragma mark 学校列表
//+ (void)getSchoolListusingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                      andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/school/version",kMainUrl];
//    
//    NSString * schoolVersion = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSchollVersion"];
//    NSDictionary * dic = nil;
//    if (schoolVersion) {
//        dic = @{@"version":schoolVersion};
//    }else{
//    dic = @{@"version":@"-1"};
//        
//    }
//    
//    [self POSTDictionaryWithStringURL:urlString Parma:dic SuccessBlock:^(NSDictionary *resultDictionary) {
//        NSLog(@"%@",urlString);
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//
//}
///**第三方登陆*/
//#pragma mark 第三方登陆
//+ (void)thirdLoginWithParam:(NSDictionary *)param
//           usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//            andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    
//    NSString * urlString = [NSString stringWithFormat:@"%@/third/login",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
////        DSXLog(@"%@",urlString);
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//
//
//}
///**获取客户标号*/
//#pragma mark 获取客户标号
//+ (void)getClientNumWithParam:(NSDictionary *)param
//             usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//              andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//    NSString * urlString = [NSString stringWithFormat:@"%@/device/create",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//}
//
//+ (void)postHeadIconWithParam:(NSDictionary *)param
//             usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//                         andFailureBlock:(void (^)(NSError *resultError))failureBlock{
////    NSString * urlString = [NSString stringWithFormat:@"%@/user/upload",kMainUrl];
////    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
////        DSXLog(@"%@",urlString);
////        sucessBlock(YES,resultDictionary);
////    } FailureBlock:^(NSError *error) {
////        
////    }];
////    
//    NSString * urlString = [NSString stringWithFormat:@"%@/user/upload",kMainUrl];
//    
//    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
//    [manager POST:urlString parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
//        
//        if (param[@"pics"]) {
//            
//           
//                
//                UIImage *image = param[@"pics"];
//                NSData *imageToUpload = UIImageJPEGRepresentation(image, 0.1);
//                [formData appendPartWithFileData:imageToUpload
//                                            name:@"pic"
//                                        fileName:@"image.jpg"
//                                        mimeType:@"image/jpg"];
//            
//        }
//        
//        for (NSString *paramKey in param.allKeys) {
//            
//            if (![paramKey isEqualToString:@"pics"]) {
//                
//                [formData appendPartWithFormData:[param[paramKey] dataUsingEncoding:NSUTF8StringEncoding]
//                                            name:paramKey];
//            }
//        }
//    } success:^(AFHTTPRequestOperation *operation, id responseObject) {
//        
//        NSDictionary *returnDic = responseObject;
//        if ([returnDic[@"stutas"] integerValue] == 0) {
//            
//            sucessBlock(YES,responseObject);
//        }
//    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//        
//        DSXLog(@"%@",error);
//    }];
//    
//}
//
///**绑定手机号*/
//#pragma mark 绑定手机号
//+ (void)bindPhoneWithParam:(NSDictionary *)param
//          usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
//           andFailureBlock:(void (^)(NSError *resultError))failureBlock{
//
//    NSString * urlString = [NSString stringWithFormat:@"%@/user/thirdBind",kMainUrl];
//    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
//        sucessBlock(YES,resultDictionary);
//    } FailureBlock:^(NSError *error) {
//        
//    }];
//
//}
///**订单操作*/
//#pragma mark 订单操作
////+ (void)changeOrderWithParam:(NSDictionary *)param
////            usingSucessBlock:(void(^)(BOOL isSucess,NSDictionary * resultDictionary))sucessBlock
////             andFailureBlock:(void (^)(NSError *resultError))failureBlock{
////    NSString * urlString = [NSString stringWithFormat:@"%@/order/operateCreate",kMainUrl];
////    [self POSTDictionaryWithStringURL:urlString Parma:param SuccessBlock:^(NSDictionary *resultDictionary) {
////        sucessBlock(YES,resultDictionary);
////    } FailureBlock:^(NSError *error) {
////        
////    }];
////}


@end